package structures.compare;

import java.util.ArrayList;
import java.util.HashMap;

public class CompareBagKeyList extends ArrayList<String> {
	private static final long serialVersionUID = 5815707831312678500L;
	
	HashMap<String, Integer> bagKeys;
	
	public CompareBagKeyList() {
		bagKeys = new HashMap<String, Integer>();
	}
	
	@Override
	public boolean add(String bagKey) {
		bagKeys.put(bagKey, size());
		return super.add(bagKey);
	}
	
	public boolean containsBagKey(String bagKey) {
		return bagKeys.containsKey(bagKey);
	}
	
	public Integer getIndex(String bagKey){
		return bagKeys.get(bagKey);
	}
}
